package com.le.sarrs.web.util

import groovy.json.JsonBuilder

import javax.servlet.http.HttpServletResponse


class Renderer {
	def error(int code, String msg,HttpServletResponse response) {
		response.setCharacterEncoding("UTF-8")
		response.setHeader("errorCode", code);
		response.setHeader("errorMsg",  URLEncoder.encode(msg, "UTF-8"));
		return "";
	}
	
	def json(obj) {
		new JsonBuilder(obj).toString()
	}
	
}
